package com.zry.pda.ui.activity

import android.util.Log
import com.zry.pda.R
import com.zry.pda.been.LoginInfoBean
import com.zry.pda.databinding.ActivityMoreOperateBinding
import com.zry.pda.presenter.MoreOperatePresenter
import com.zry.pda.ui.base.BaseActivity
import com.zry.pda.update.PackageInfoUtil
import com.zry.pda.utils.ACacheUtil
import kotlinx.android.synthetic.main.activity_more_operate.*
import kotlinx.android.synthetic.main.common_title.*


class MoreOperateActivity : BaseActivity() {
    private var moreOperateBinding: ActivityMoreOperateBinding? = null
    private var moreOperatePresenter: MoreOperatePresenter? = null
    private var loginInfoBean: LoginInfoBean? = null


    override fun getLayoutId(): Int {
        return R.layout.activity_more_operate
    }

    override fun initData() {
        moreOperateBinding = viewDataBinding as ActivityMoreOperateBinding
        moreOperatePresenter = MoreOperatePresenter(this)
        moreOperateBinding?.moreClick = moreOperatePresenter


        titleCenterText.text = getString(R.string.moreOperate)
        commonLeftLinearLayout.setOnClickListener { this.finish() }

        userNameText.text = ACacheUtil().getUsername()
        userAccountText.text = ACacheUtil().getUsername()

        loginInfoBean = ACacheUtil().getLoginInfo()
        Log.e("TAG", loginInfoBean.toString())
        moreOperateBinding?.loginInfoBean = loginInfoBean

        initView()
    }

    private fun initView() {
        moreOperatePresenter?.checkApp(PackageInfoUtil.getVersionName(this).toString())
    }


}
